package com.jwiki.app.jkeeper.common.jdbc;

import java.util.List;

public class Page<E> {

    private int offset;

    private int limit;

    private long total;

    private int pages;

    private List<E> data;

    public Page(int offset, int limit) {
        this.offset = offset;
        this.limit = limit;
    }

    public int getOffset() {
        return offset;
    }

    public int getLimit() {
        return limit;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
        this.pages = (int) (total/limit + (total%limit == 0 ? 0 : 1));
    }

    public int getPages() {
        return pages;
    }

    public List<E> getData() {
        return data;
    }

    public void setData(List<E> data) {
        this.data = data;
    }

}
